#!/usr/bin/python
'''
Created on Jul 7, 2012

@author: peng
'''

source_list = []
target_list = []

source_file = open('/home/peng/test/images.txt')
target_file = open('/home/peng/test/local_image_file_full.txt')

source_line = source_file.readline()
while source_line:
    try:
        source_list += [l.strip() for l in source_line.split()]
    except Exception, e:
        print str(e)
    finally:
        source_line = source_file.readline()

source_file.close()

target_line = target_file.readline()
while target_line:
    try:
        target_list.append(target_line.replace('/home/baina/img/', '').
                                                    replace('\n', '').strip())
    except Exception, e:
        print str(e)
    finally:
        target_line = target_file.readline()

missed_file = open('/home/peng/test/missed.txt', 'w')
missed_list = set(target_list) - set(source_list)

for mf in missed_list:
    missed_file.write(mf + '\n')

missed_file.close()
